package com.xyb.vo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RegisterUserVo {
    public interface checkIphoneNo {
    }

    public interface checkEmail {
    }

    public interface reg {
    }

    @NotBlank(message = "昵称不能为空", groups = {RegisterUserVo.reg.class})
    @Length(min = 1, max = 20,message="请设置1到20个字符以内的昵称")
    private String userNickName;

    @NotBlank(message = "手机号不能为空", groups = {RegisterUserVo.reg.class, RegisterUserVo.checkIphoneNo.class})
    @Pattern(regexp = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$", message = "手机号格式错误", groups = {RegisterUserVo.reg.class, RegisterUserVo.checkIphoneNo.class})
    private String iphoneNo;

    @NotBlank(message = "邮箱号不能为空", groups = {RegisterUserVo.reg.class, RegisterUserVo.checkEmail.class})
    @Email(regexp = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$", message = "邮箱格式错误", groups = {RegisterUserVo.reg.class, RegisterUserVo.checkEmail.class})
    private String email;

    @NotBlank(message = "密码不能为空", groups = {RegisterUserVo.reg.class})
    private String userPwd;

    @NotNull(message = "验证码不能为空", groups = {RegisterUserVo.reg.class})
    private Integer verifyCode;
}
